<HTML><HEAD><TITLE>current_macro(-TermClass, -TransPred, -Options, -Module)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">Syntax Settings</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>current_macro(-TermClass, -TransPred, -Options, -Module)</H1>
Succeeds if TermClass is a macro with the transformation predicate
TransPred defined in module Module and flags Options.


<DL>
<DT><EM>TermClass</EM></DT>
<DD>Term in the form Atom/Integer or atom or variable.
</DD>
<DT><EM>TransPred</EM></DT>
<DD>Term in the form Atom/Integer or variable.
</DD>
<DT><EM>Options</EM></DT>
<DD>List or a variable.
</DD>
<DT><EM>Module</EM></DT>
<DD>Atom or variable.
</DD>
</DL>
<H2>Description</H2>
   This predicate enumerates all visible macros and retrieves their
   definition.  The arguments TransPred and Options correspond to the
   arguments of macro/3 or portray/3.  Module is the definition module of
   TransPred and it can be used for calling the TransPred explicitly (e.g.
   using :/2).

<P>

<H3>Modes and Determinism</H3><UL>
<LI>current_macro(-, -, -, -) is nondet
</UL>
<H3>Modules</H3>
This predicate is sensitive to its module context (tool predicate, see @/2).
<H3>Exceptions</H3>
<DL>
<DT><EM>(5) type error </EM>
<DD>TermClass not of form Atom/Integer.
<DT><EM>(5) type error </EM>
<DD>TransPred not of form Atom/Integer.
<DT><EM>(5) type error </EM>
<DD>Options not a list.
</DL>
<H2>Examples</H2>
<PRE>
[eclipse]: [user].             % define a macro
 tr_a(a(X), b(X,X)).
 :- local macro(a/1, tr_a/2, []).

yes.
[eclipse]: current_macro(F, T, O, M).  % list visible macros

F = (--&gt;) / 2                  % predefined macro
T = trdcg / 3
O = [global, clause]
M = macro     More? (;)

F = (if) / 2                   % predefined macro
T = tr_if / 2
O = [global, clause]
M = coroutine     More? (;)

F = a / 1                      % our user defined macro
T = tr_a / 2
O = [local]
M = eclipse     More? (;)

F = no_macro_expansion / 1     % predefined macro
T = trprotect / 2
O = [global, protect_arg]
M = macro     More? (;)

no (more) solution.



</PRE>
<H2>See Also</H2>
<A HREF="../../kernel/syntax/macro-3.html">macro / 3</A>, <A HREF="../../kernel/syntax/portray-3.html">portray / 3</A>, <A HREF="../../kernel/syntax/erase_macro-2.html">erase_macro / 2</A>
</BODY></HTML>
